GBML manual / Drawing

sprite_frames

How many animation frames a sprite asset has. The asset-level twin of frame_count below: frame_count always answers for whichever sprite THIS instance currently shows; sprite_frames answers for any sprite asset you name, including one this instance is not showing, or never shows at all.

Sega Genesis: not built yet

On other consoles this differs: see Side by side and How the consoles differ.

Syntax

sprite_frames(spr) -> int

Arguments

NameType
sprsprite

Returns

int

Description

How many animation frames a sprite asset has - the asset-level twin of frame_count: frame_count always answers for whichever sprite THIS instance currently shows, while sprite_frames answers for any sprite asset you name, including one this instance is not showing right now, or ever.

Example

frame = sprite_frames(spr_doc_hero) - 1;

Jumps straight to the last frame of spr_doc_hero - useful for freezing an animation on its final pose without hard-coding how many frames that sprite's own art happens to have.

On the GBA

Same compile-time read as sprite_width — see its own gba note.

See also: frame_countsprite_widthsprite_height